$('body').on('click', '#addHeadActorsBtn', function () {
    // 获取被点击的input 标签
    let $inputs = $("#headActorsAddMovie input:checked");
    let arr = [];
    $inputs.each(function (index, input) {
        
        arr.push($(input).attr('data-id'));
    })
    //把id传给后端
    $.ajax({
        url: "/movies",
        type: 'put',
        data: {
            //演员id：可以在切换关联电影时，设置自定义属性来保存
            id: "6160f2a1c3270000ce0012d2",
            //选择的电影id
            moviesId: arr.join(",")
        },
        success: function (data) {
            console.log(data);
        }
    });
})